<?php
    //подклюяение основной библиотеки
    include('inc/init.php');

    m::c('user');

    if ( !is_file( DATA_PATH . 'conf.dat'   ) )
    {
        if ( isset($_POST['new_password']) and isset($_POST['new_login']) and !empty($_POST['new_password'])  and !empty($_POST['new_login']))
        {
           
            $login = $_POST['new_login'];
            $pass = md5 ( md5 ( md5 ( $_POST['new_login'] ) ) );
            m::json_data_save('conf.dat', array('login'=>$login, 'pass'=>$pass) );
            m::r('index.php');  
        }
        else
        {
            include( PAGE_PATH . 'pass.php');
        } 
        die('');
    }

    if ( isset( $_GET['p']) && !empty($_GET['p'])  )
    {
        //получаем список плагинов
        p::get_list(); 
        p::do_action('page', $_GET['p']); 
    }
    else
    {
        if ( user::login() == 0 )
        {
            include( PAGE_PATH . 'login.php');
        }
        else
        {
            m::r ('admin.php');
        }
    }

    include('inc/end.php');
?>